import random

from Captcha.Visual import Text, Backgrounds, Distortions, ImageCaptcha
from Captcha.Words import WordList


class DefaultCaptcha(ImageCaptcha):
    defaultSize = (130,50)

    def getLayers(self):
        word = WordList('basic-english').pick()
        self.addSolution(word)
        return [random.choice([Backgrounds.CroppedImage(), Backgrounds.TiledImage()]),
                Text.TextLayer(word, borderSize=1, fontFactory=Text.FontFactory(18, "vera/VeraBd.ttf")),
                Distortions.SineWarp()]
